﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BugTracker.BusinessLogic.WorkLog
{
    public class WorkLogMapper : IWorkLogMapper
    {
        #region IWorkLogMapper Members

        public DataAccess.Data.WorkLog Map(BusinessEntities.Entities.WorkLog.WorkLog value)
        {
            DataAccess.Data.WorkLog result = new DataAccess.Data.WorkLog();
            result.WorkLogID = value.WorkLogID;
            result.IssueID = value.IssueID;
            result.EntryDate = value.EntryDate;
            result.Detail = value.Detail;
            result.WorkHours = value.WorkHours;
            result.IsActive = value.IsActive;
            result.IsDeleted = value.IsDeleted;
            result.RowGuid = value.RowGuid;
            result.CreatedOn = value.CreatedOn;
            result.ModifiedOn = value.ModifiedOn;
            result.UserId = value.UserId;
            return result;
        }

        public BusinessEntities.Entities.WorkLog.WorkLog Map(DataAccess.Data.WorkLog value)
        {
            BusinessEntities.Entities.WorkLog.WorkLog result = 
                new BusinessEntities.Entities.WorkLog.WorkLog();
            result.WorkLogID = value.WorkLogID;
            result.IssueID = value.IssueID;
            result.EntryDate = value.EntryDate;
            result.Detail = value.Detail;
            result.WorkHours = value.WorkHours;
            result.IsActive = value.IsActive;
            result.IsDeleted = value.IsDeleted;
            result.RowGuid = value.RowGuid;
            result.CreatedOn = value.CreatedOn;
            result.ModifiedOn = value.ModifiedOn;
            result.UserId = value.UserId;
            return result;
        }

        public void Map(DataAccess.Data.WorkLog result, BusinessEntities.Entities.WorkLog.WorkLog value, bool includeKey = false)
        {
            if (includeKey)
            {
                value.WorkLogID = result.WorkLogID;
            }
            result.IssueID = value.IssueID;
            result.EntryDate = value.EntryDate;
            result.Detail = value.Detail;
            result.WorkHours = value.WorkHours;
            value.IsActive = result.IsActive;
            value.IsDeleted = result.IsDeleted;
            value.RowGuid = result.RowGuid;
            value.CreatedOn = result.CreatedOn;
            value.ModifiedOn = result.ModifiedOn;
            value.UserId = result.UserId;
        }

        public void Map(BusinessEntities.Entities.WorkLog.WorkLog result, DataAccess.Data.WorkLog value, bool includeKey = false)
        {
            if (includeKey)
            {
                value.WorkLogID = result.WorkLogID;
            }
            result.IssueID = value.IssueID;
            result.EntryDate = value.EntryDate;
            result.Detail = value.Detail;
            result.WorkHours = value.WorkHours;
            value.IsActive = result.IsActive;
            value.IsDeleted = result.IsDeleted;
            value.RowGuid = result.RowGuid;
            value.CreatedOn = result.CreatedOn;
            value.ModifiedOn = result.ModifiedOn;
            value.UserId = result.UserId;
        }

        #endregion
    }
}
